<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/static/common/default.jsp"%>
<html>
	<head>
	    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<style type="text/css">
			.select_option{
				width: 180px;
				z-index: 1;
				position: absolute;
			}
			.select_showbox{
				width: 175px;
			}
		</style>
		<link type="text/css" rel="stylesheet" href="${ctx}/static/tools/jquery-validationEngine/validationEngine.jquery.css"></link>
	</head>
	<body>
		<script type="text/javascript" src="${ctx}/static/tools/jquery-validationEngine/jquery.validationEngine.js"></script>
		<script type="text/javascript" src="${ctx}/static/tools/jquery-validationEngine/jquery.validationEngine-cn.js"></script>
		<div class="cinema_tip">
		    <div class="cinema_subject clearfix">
		        <div class="cinema_title">
		            <a href="javascript:void(0);">系统管理</a> >
		            <a id="userinfo_list_href" href="${ctx}/sys/user/list">修改密码</a> 
		        </div>
		    </div>
		</div>
		<div class="cinema_list">
			<form class="form-horizontal" onsubmit="return sysUserfoModify();" id="userForm"  name="userForm" method="post">
			<div class="movie_list">
				<dl class="movie_fill">
					<dt class="movie_word clearfix">
						<p>原密码：</p>
					</dt>
					<dd class="mleft_99">
						<div class="movie_type cinema_feed">
							<input id="oldPassword" type="password" name="oldPassword" value="" class="validate[required,maxSize[50]]" maxlength="50" />
						</div>
					</dd>		
				</dl>
				
				<div class="clearfix"></div>
				<dl class="movie_fill">
					<dt class="movie_word clearfix">
						<p>新密码：</p>
					</dt>
					<dd class="mleft_99">
						<div class="movie_type cinema_feed">
							<input id="newPassword" type="password" name="newPassword" value="" class="validate[required,maxSize[50]]" maxlength="100" />
						</div>
					</dd>
				</dl>
				<div class="clearfix"></div>
				<a class="movie_continue">
						<input type="submit" name="submit" id="submit" value="提交" class="cinema_inquiry" />
				</a>
			</div>	
			</form>
		</div>
		<script type="text/javascript">
			//项目基本信息修改
			function sysUserfoModify(){
				if ($("#userForm").validationEngine("validate")) {
					var datastr = new Object();
	    			datastr.oldPassword = $('#oldPassword').val();
	    			datastr.newPassword = $('#newPassword').val();
					var result = true;
					$.ajax({
	    		        async: true,
	    		        type:"POST",
	    		        data:JSON.stringify(datastr),
	    		        url: "${ctx}/sys/user/toUpdatePwd",
	    		        dataType: "json",
	    		        headers : {  
	                        'Content-Type' : 'application/json;charset=utf-8'  
	                    },
	                    success : function(data) {
	                		if (data != undefined && data.status != undefined
	                				&& data.status.trim() == '0') {
	                			result = true;
	                			alert("密码修改成功！");
	                		} else {
	                			result = false;
	                			alert(data.error);
	                		}
	                	},
	    			},"json");
				}
				return false;		
			}
		</script>
	</body>
</html>